package com.linshidream.intrachat.simplenio.pipeline;

import com.linshidream.intrachat.simplenio.pipeline.context.MiniHandlerContext;
import com.linshidream.intrachat.simplenio.pipeline.handler.MiniChannelInboundHandler;

/**
 * Created on 2025/8/17 21:48
 *
 * @author linshidream
 * @version 1.0.0
 * @description
 */

public class ServerCheckHandler implements MiniChannelInboundHandler {

    @Override
    public void channelRead(MiniHandlerContext ctx, Object msg) {
        // 目前只关系String 类型的消息 其他非业务消息不管
        if (msg instanceof String) {
            try {
                // 假设 此处对消息进行过滤 审计 等工作
                System.out.println(ctx.handlerName() + ", 审计消息:" + msg);

                ctx.fireChannelRead(msg);

            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            ctx.fireChannelRead(msg);
        }
    }
}
